package com.yuanian.timingwheel.context;

import com.yuanian.timingwheel.model.slot.Slot;
import com.yuanian.timingwheel.model.timingwheel.DayTimingWheel;
import com.yuanian.timingwheel.model.timingwheel.SecondTimingWheel;

import java.util.concurrent.atomic.AtomicLong;

public class ExecutionContext {

    private static final ExecutionContext ctx = new ExecutionContext();
    private ExecutionContext() {

    }
    protected DayTimingWheel dayTimingWheel;

    protected SecondTimingWheel secondTimingWheel;

    protected Slot slot;

    protected AtomicLong executedTaskCnt = new AtomicLong(0);

    public void addExecutedTaskCnt() {
        executedTaskCnt.getAndIncrement();
    }

    public long getExecutedTaskCnt() {
        return executedTaskCnt.get();
    }

    public static ExecutionContext getInstance() {
        return ctx;
    }

    public DayTimingWheel getDayTimingWheel() {
        return dayTimingWheel;
    }

    public void setDayTimingWheel(DayTimingWheel dayTimingWheel) {
        this.dayTimingWheel = dayTimingWheel;
    }

    public SecondTimingWheel getSecondTimingWheel() {
        return secondTimingWheel;
    }

    public void setSecondTimingWheel(SecondTimingWheel secondTimingWheel) {
        this.secondTimingWheel = secondTimingWheel;
    }

    public Slot getSlot() {
        return slot;
    }

    public void setSlot(Slot slot) {
        this.slot = slot;
    }
}
